import { createApp } from "vue";
import App from "./App.vue";

// 样式文件
import "../main.css";
import "reset-css";
import "./assets/font/iconfont.css";
import "./styles/global.less";

// Element Plus
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import * as ElementPlusIconsVue from '@element-plus/icons-vue';

// 路由和状态管理
import router from "./router";
import store from "./store";

// 权限指令
import permissionDirectives from './directives/permission';

const app = createApp(App);

// 注册所有 Element Plus 图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}

// 注册权限指令
Object.keys(permissionDirectives).forEach(key => {
  app.directive(key, permissionDirectives[key]);
});

app.use(router);
app.use(ElementPlus);
app.use(store);
app.mount("#app");
